package com.demo.spzx.model.vo.common;

import com.demo.spzx.model.vo.system.LoginVo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

@Data
@Schema
public class Result<T> {

    @Schema(description = "响应结果实体")
    private Integer code;

    @Schema(description = "业务状态码")
    private String message;

    @Schema(description = "响应消息")
    private T data;

    private Result(){}


    public static <T> Result<T> build(T body, Integer code, String message){

        Result<T> result=new Result<>();
        result.setData(body);
        result.setCode(code);
        result.setMessage(message);
        return result;
    }

    public static <T> Result build(T body,ResultCodeEnum resultCodeEnum){
       return build(body,resultCodeEnum.getCode(), resultCodeEnum.getMessage());

    }

}
